/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package view.frontend.pdf;

import com.itextpdf.text.BadElementException;
import com.itextpdf.text.DocumentException;
import exceptionManager.ExceptionManager;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.MalformedURLException;
import java.text.DecimalFormat;
import javax.swing.JPanel;
import model.Order;
import model.OrderLine;
import view.generaldesign.DesignLayout;

/**
 *
 * @author Allan
 */
public class AccountStatement extends javax.swing.JFrame
{
    private int orderNumber;
    private String customerPhone;
    private Order order;
    private OrderLine orderLine;
    private String workingFolder;
    
    /**
     * Creates new form AccountStatement
     */
    public AccountStatement(Order ordre)
    {
        workingFolder = "Kontoudtoge";
        
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        double width = screenSize.getWidth();
        double height = screenSize.getHeight();

        double yPos;
        double xPos;

        xPos = (width / 2) - 325;
        yPos = (height / 2) - 375;

        this.setUndecorated(true);
        initComponents();
        this.setBounds((int) xPos, (int) yPos, 650, 710); //(x, y, width, height)
        
        order = ordre;
        orderLine = order.getOrderLine().get(0);
        DecimalFormat format = new DecimalFormat("#,##0.0#");
        
        // Set ordernumber and customer phonenumber in variables
        orderNumber = order.getTombStone().getMorticianCommissionNo();
        customerPhone = order.getCustomerSpecified()[1].getCustomerTelephone().getNumber();
        
        // Set customer info
        lblCustomerName.setText(order.getCustomerSpecified()[1].getCustomerName().getName());
        lblCustomerAddress.setText(order.getCustomerSpecified()[1].getCustomerAddress().getStreet());
        lblCustomerZip.setText(order.getCustomerSpecified()[1].getCustomerAddress().getZipCode().toString());
        lblCustomerPhone.setText("Tlf.: " + customerPhone);
        
        // Set date and orderNo
        lblDate.setText(order.getInvoice_date());
        lblInvoiceNumber.setText("" + orderNumber);
        
        // Set Subject
        txtSubject.setFont(DesignLayout.PDF_PLAIN_12);
        txtSubject.setText("Bejerholms Stenhuggeri ApS tilgodehavende");
        
        // Set orderlines
        JPanel panel = new OrderLinePanel(order, orderLine, 5);
        panel.setBounds(0, 2 + (0 * 14), 510, 14);
        orderlinePanel.add(panel);
        
        panel = new OrderLinePanel(order, orderLine, 6);
        panel.setBounds(0, 2 + (1 * 14), 510, 14);
        orderlinePanel.add(panel);
        
        // Set subtotal
        double totalBeforeVAT;
        totalBeforeVAT = order.totalPrice() + (((order.getTombStone().getCommision() / 100) * order.totalPrice()) * -1);
        lblSubtotal.setText("" + format.format(totalBeforeVAT));
        
        // Set VAT %
        double vat;
        vat = order.getProgramValues().getVat();
        lblVAT.setText("" + vat + "%");
        
        // Set salestax, VAT in Dkk
        double salesTax;
        salesTax = (totalBeforeVAT / 100) * 25;
        lblSalesTax.setText("" + format.format(salesTax));
        
        // Set totalSum
        double total;
        total = totalBeforeVAT + salesTax;
        lblTotalSum.setText("" + format.format(total));
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents()
    {

        jPanel2 = new javax.swing.JPanel();
        jButton3 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        borderPanel = new javax.swing.JPanel();
        documentPanel = new javax.swing.JPanel();
        orderlinePanel = new javax.swing.JPanel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        lblCustomerName = new javax.swing.JLabel();
        lblCustomerAddress = new javax.swing.JLabel();
        lblCustomerZip = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jLabel23 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        lblDate = new javax.swing.JLabel();
        lblInvoiceNumber = new javax.swing.JLabel();
        lblPaymentTerms3 = new javax.swing.JLabel();
        jLabel29 = new javax.swing.JLabel();
        lblPaymentTerms1 = new javax.swing.JLabel();
        lblPaymentTerms2 = new javax.swing.JLabel();
        jLabel32 = new javax.swing.JLabel();
        jLabel33 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jPanel4 = new javax.swing.JPanel();
        jPanel5 = new javax.swing.JPanel();
        jPanel6 = new javax.swing.JPanel();
        jPanel7 = new javax.swing.JPanel();
        lblCustomerPhone = new javax.swing.JLabel();
        jPanel8 = new javax.swing.JPanel();
        jLabel70 = new javax.swing.JLabel();
        lblSubtotal = new javax.swing.JLabel();
        jPanel9 = new javax.swing.JPanel();
        lblVAT = new javax.swing.JLabel();
        jPanel10 = new javax.swing.JPanel();
        jLabel71 = new javax.swing.JLabel();
        lblSalesTax = new javax.swing.JLabel();
        jPanel11 = new javax.swing.JPanel();
        jLabel72 = new javax.swing.JLabel();
        lblTotalSum = new javax.swing.JLabel();
        jLabel69 = new javax.swing.JLabel();
        jLabel68 = new javax.swing.JLabel();
        jLabel66 = new javax.swing.JLabel();
        jLabel67 = new javax.swing.JLabel();
        txtSubject = new javax.swing.JTextArea();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        getContentPane().setLayout(null);

        jButton3.setText("Export PDF");
        jButton3.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                jButton3ActionPerformed(evt);
            }
        });

        jButton4.setText("Close page");
        jButton4.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                jButton4ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(11, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jButton3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 642, Short.MAX_VALUE)
                .addComponent(jButton4)
                .addContainerGap())
        );

        getContentPane().add(jPanel2);
        jPanel2.setBounds(531, 0, 120, 710);

        borderPanel.setBackground(new java.awt.Color(255, 255, 255));
        borderPanel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        borderPanel.setLayout(null);

        documentPanel.setBackground(new java.awt.Color(255, 255, 255));
        documentPanel.setLayout(null);

        orderlinePanel.setOpaque(false);
        orderlinePanel.setLayout(null);
        documentPanel.add(orderlinePanel);
        orderlinePanel.setBounds(10, 295, 510, 193);

        jLabel6.setFont(new java.awt.Font("Lucida Sans", 1, 10)); // NOI18N
        jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel6.setText("Bejerholms Stenhuggeri v/René Bejerholm Poulsen");
        documentPanel.add(jLabel6);
        jLabel6.setBounds(231, 90, 290, 14);

        jLabel7.setFont(new java.awt.Font("Lucida Sans", 0, 10)); // NOI18N
        jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel7.setText("Fægangen 8, 4220 Korsør, Tlf. 58 35 00 04");
        documentPanel.add(jLabel7);
        jLabel7.setBounds(231, 100, 290, 14);

        jLabel8.setFont(new java.awt.Font("Lucida Sans", 0, 10)); // NOI18N
        jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel8.setText("Nørre Allé 1, 4400 Kalundborg, Tlf. 42 76 00 04");
        documentPanel.add(jLabel8);
        jLabel8.setBounds(231, 110, 290, 14);

        jLabel9.setFont(new java.awt.Font("Lucida Sans", 0, 10)); // NOI18N
        jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel9.setText("Fax 58 35 00 33");
        documentPanel.add(jLabel9);
        jLabel9.setBounds(231, 120, 290, 14);

        jLabel10.setFont(new java.awt.Font("Lucida Sans", 0, 10)); // NOI18N
        jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel10.setText("bejerholms.stenhuggeri@gmail.com");
        documentPanel.add(jLabel10);
        jLabel10.setBounds(231, 130, 290, 14);

        jLabel11.setFont(new java.awt.Font("Lucida Sans", 0, 10)); // NOI18N
        jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel11.setText("www.bejerholm-stenhuggeri.dk");
        documentPanel.add(jLabel11);
        jLabel11.setBounds(231, 140, 290, 14);

        jLabel12.setFont(new java.awt.Font("Lucida Sans", 0, 10)); // NOI18N
        jLabel12.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel12.setText("CVR-NR: 32931898");
        documentPanel.add(jLabel12);
        jLabel12.setBounds(231, 150, 290, 14);

        jLabel13.setFont(new java.awt.Font("Lucida Sans", 1, 10)); // NOI18N
        jLabel13.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel13.setText("Nordea - Reg. nr. 2190");
        documentPanel.add(jLabel13);
        jLabel13.setBounds(231, 160, 290, 14);

        jLabel14.setFont(new java.awt.Font("Lucida Sans", 1, 10)); // NOI18N
        jLabel14.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel14.setText("Konto 0754977361");
        documentPanel.add(jLabel14);
        jLabel14.setBounds(231, 170, 290, 14);

        jLabel15.setFont(new java.awt.Font("Lucida Sans", 1, 24)); // NOI18N
        jLabel15.setText("Kontoudtog");
        documentPanel.add(jLabel15);
        jLabel15.setBounds(10, 40, 160, 29);

        jLabel16.setFont(new java.awt.Font("Lucida Sans", 1, 12)); // NOI18N
        jLabel16.setText("Faktureres til:");
        documentPanel.add(jLabel16);
        jLabel16.setBounds(10, 80, 90, 14);

        lblCustomerName.setFont(new java.awt.Font("Lucida Sans", 0, 11)); // NOI18N
        documentPanel.add(lblCustomerName);
        lblCustomerName.setBounds(100, 80, 150, 14);

        lblCustomerAddress.setFont(new java.awt.Font("Lucida Sans", 0, 11)); // NOI18N
        documentPanel.add(lblCustomerAddress);
        lblCustomerAddress.setBounds(100, 93, 150, 14);

        lblCustomerZip.setFont(new java.awt.Font("Lucida Sans", 0, 11)); // NOI18N
        documentPanel.add(lblCustomerZip);
        lblCustomerZip.setBounds(100, 106, 150, 14);

        jLabel20.setFont(new java.awt.Font("Lucida Sans", 1, 12)); // NOI18N
        jLabel20.setText("Vedrørende:");
        documentPanel.add(jLabel20);
        jLabel20.setBounds(10, 230, 80, 14);

        jLabel23.setFont(new java.awt.Font("Lucida Sans", 1, 12)); // NOI18N
        jLabel23.setText("DATO:");
        documentPanel.add(jLabel23);
        jLabel23.setBounds(330, 200, 100, 14);

        jLabel24.setFont(new java.awt.Font("Lucida Sans", 1, 12)); // NOI18N
        jLabel24.setText("PROVISIONS NR:");
        documentPanel.add(jLabel24);
        jLabel24.setBounds(330, 213, 100, 14);

        lblDate.setFont(new java.awt.Font("Lucida Sans", 0, 12)); // NOI18N
        lblDate.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        documentPanel.add(lblDate);
        lblDate.setBounds(430, 200, 90, 14);

        lblInvoiceNumber.setFont(new java.awt.Font("Lucida Sans", 0, 12)); // NOI18N
        lblInvoiceNumber.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        documentPanel.add(lblInvoiceNumber);
        lblInvoiceNumber.setBounds(430, 213, 90, 14);

        lblPaymentTerms3.setFont(new java.awt.Font("Lucida Sans", 0, 12)); // NOI18N
        lblPaymentTerms3.setText("\"Fakturanummer og navn\" bedes anført ved bankoverførsel");
        documentPanel.add(lblPaymentTerms3);
        lblPaymentTerms3.setBounds(10, 636, 510, 14);

        jLabel29.setFont(new java.awt.Font("Lucida Sans", 1, 12)); // NOI18N
        jLabel29.setText("Betalingsbetingelser:");
        documentPanel.add(jLabel29);
        jLabel29.setBounds(10, 610, 131, 14);

        lblPaymentTerms1.setFont(new java.awt.Font("Lucida Sans", 0, 12)); // NOI18N
        lblPaymentTerms1.setText("Netto 14 dage");
        documentPanel.add(lblPaymentTerms1);
        lblPaymentTerms1.setBounds(143, 610, 380, 14);

        lblPaymentTerms2.setFont(new java.awt.Font("Lucida Sans", 0, 12)); // NOI18N
        lblPaymentTerms2.setText("Nordea: 2190 - 0754977361");
        documentPanel.add(lblPaymentTerms2);
        lblPaymentTerms2.setBounds(10, 623, 510, 14);

        jLabel32.setFont(new java.awt.Font("Lucida Sans", 0, 10)); // NOI18N
        jLabel32.setText("René Bejerholm Poulsen, 58 35 00 04, bejerholm@bejerholms-stenhuggeri.dk");
        documentPanel.add(jLabel32);
        jLabel32.setBounds(10, 680, 510, 14);

        jLabel33.setFont(new java.awt.Font("Lucida Sans", 0, 10)); // NOI18N
        jLabel33.setText("Hvis der er spørgsmål til denne faktura, bedes De venligst kontakte");
        documentPanel.add(jLabel33);
        jLabel33.setBounds(10, 670, 510, 14);

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/images/logo_docs.png"))); // NOI18N
        documentPanel.add(jLabel1);
        jLabel1.setBounds(350, 5, 170, 80);

        jPanel3.setBackground(new java.awt.Color(204, 204, 204));
        jPanel3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel3.setLayout(null);

        jLabel3.setFont(new java.awt.Font("Lucida Sans", 1, 9)); // NOI18N
        jLabel3.setText("ANTAL");
        jPanel3.add(jLabel3);
        jLabel3.setBounds(10, 0, 40, 14);

        jLabel2.setFont(new java.awt.Font("Lucida Sans", 1, 9)); // NOI18N
        jLabel2.setText("BESKRIVELSE");
        jPanel3.add(jLabel2);
        jLabel2.setBounds(140, 0, 70, 14);

        jLabel4.setFont(new java.awt.Font("Lucida Sans", 1, 9)); // NOI18N
        jLabel4.setText("ENHEDSPRIS");
        jPanel3.add(jLabel4);
        jLabel4.setBounds(340, 0, 60, 14);

        jLabel5.setFont(new java.awt.Font("Lucida Sans", 1, 9)); // NOI18N
        jLabel5.setText("BELØB");
        jPanel3.add(jLabel5);
        jLabel5.setBounds(440, 0, 40, 14);

        documentPanel.add(jPanel3);
        jPanel3.setBounds(10, 280, 510, 15);

        jPanel4.setBackground(new java.awt.Color(255, 255, 255));
        jPanel4.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel4.setLayout(null);
        documentPanel.add(jPanel4);
        jPanel4.setBounds(10, 290, 60, 200);

        jPanel5.setBackground(new java.awt.Color(255, 255, 255));
        jPanel5.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel5.setLayout(null);
        documentPanel.add(jPanel5);
        jPanel5.setBounds(60, 290, 280, 200);

        jPanel6.setBackground(new java.awt.Color(255, 255, 255));
        jPanel6.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel6.setLayout(null);
        documentPanel.add(jPanel6);
        jPanel6.setBounds(310, 290, 100, 200);

        jPanel7.setBackground(new java.awt.Color(204, 204, 204));
        jPanel7.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel7.setLayout(null);
        documentPanel.add(jPanel7);
        jPanel7.setBounds(400, 290, 120, 200);

        lblCustomerPhone.setFont(new java.awt.Font("Lucida Sans", 0, 11)); // NOI18N
        documentPanel.add(lblCustomerPhone);
        lblCustomerPhone.setBounds(100, 119, 150, 14);

        jPanel8.setBackground(new java.awt.Color(204, 204, 204));
        jPanel8.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel8.setLayout(null);

        jLabel70.setFont(new java.awt.Font("Lucida Sans", 0, 10)); // NOI18N
        jLabel70.setText("kr.");
        jPanel8.add(jLabel70);
        jLabel70.setBounds(5, 15, 20, 14);

        lblSubtotal.setFont(new java.awt.Font("Lucida Sans", 0, 10)); // NOI18N
        lblSubtotal.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jPanel8.add(lblSubtotal);
        lblSubtotal.setBounds(26, 15, 80, 14);

        documentPanel.add(jPanel8);
        jPanel8.setBounds(409, 480, 111, 30);

        jPanel9.setBackground(new java.awt.Color(255, 255, 255));
        jPanel9.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel9.setLayout(null);

        lblVAT.setFont(new java.awt.Font("Lucida Sans", 0, 10)); // NOI18N
        lblVAT.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jPanel9.add(lblVAT);
        lblVAT.setBounds(26, 15, 80, 14);

        documentPanel.add(jPanel9);
        jPanel9.setBounds(409, 500, 111, 30);

        jPanel10.setBackground(new java.awt.Color(204, 204, 204));
        jPanel10.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel10.setLayout(null);

        jLabel71.setFont(new java.awt.Font("Lucida Sans", 0, 10)); // NOI18N
        jLabel71.setText("kr.");
        jPanel10.add(jLabel71);
        jLabel71.setBounds(5, 15, 20, 14);

        lblSalesTax.setFont(new java.awt.Font("Lucida Sans", 0, 10)); // NOI18N
        lblSalesTax.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jPanel10.add(lblSalesTax);
        lblSalesTax.setBounds(26, 15, 80, 14);

        documentPanel.add(jPanel10);
        jPanel10.setBounds(409, 520, 111, 30);

        jPanel11.setBackground(new java.awt.Color(255, 255, 255));
        jPanel11.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel11.setLayout(null);

        jLabel72.setFont(new java.awt.Font("Lucida Sans", 0, 10)); // NOI18N
        jLabel72.setText("kr.");
        jPanel11.add(jLabel72);
        jLabel72.setBounds(5, 15, 20, 14);

        lblTotalSum.setFont(new java.awt.Font("Lucida Sans", 0, 10)); // NOI18N
        lblTotalSum.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jPanel11.add(lblTotalSum);
        lblTotalSum.setBounds(26, 15, 80, 14);

        documentPanel.add(jPanel11);
        jPanel11.setBounds(409, 540, 111, 30);

        jLabel69.setFont(new java.awt.Font("Lucida Sans", 1, 10)); // NOI18N
        jLabel69.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel69.setText("I ALT");
        documentPanel.add(jLabel69);
        jLabel69.setBounds(325, 555, 80, 14);

        jLabel68.setFont(new java.awt.Font("Lucida Sans", 0, 10)); // NOI18N
        jLabel68.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel68.setText("SALGSMOMS");
        documentPanel.add(jLabel68);
        jLabel68.setBounds(325, 535, 80, 14);

        jLabel66.setFont(new java.awt.Font("Lucida Sans", 0, 10)); // NOI18N
        jLabel66.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel66.setText("SUBTOTAL");
        documentPanel.add(jLabel66);
        jLabel66.setBounds(325, 495, 80, 14);

        jLabel67.setFont(new java.awt.Font("Lucida Sans", 0, 10)); // NOI18N
        jLabel67.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel67.setText("MOMS");
        documentPanel.add(jLabel67);
        jLabel67.setBounds(325, 515, 80, 14);

        txtSubject.setEditable(false);
        txtSubject.setColumns(20);
        txtSubject.setFont(new java.awt.Font("Lucida Sans", 0, 11)); // NOI18N
        txtSubject.setLineWrap(true);
        txtSubject.setRows(2);
        txtSubject.setWrapStyleWord(true);
        txtSubject.setAutoscrolls(false);
        txtSubject.setBorder(null);
        txtSubject.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        txtSubject.setDebugGraphicsOptions(javax.swing.DebugGraphics.NONE_OPTION);
        txtSubject.setDisabledTextColor(new java.awt.Color(0, 0, 0));
        txtSubject.setFocusable(false);
        documentPanel.add(txtSubject);
        txtSubject.setBounds(10, 245, 510, 28);

        borderPanel.add(documentPanel);
        documentPanel.setBounds(2, 2, 525, 700);

        getContentPane().add(borderPanel);
        borderPanel.setBounds(0, 0, 530, 710);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton4ActionPerformed
    {//GEN-HEADEREND:event_jButton4ActionPerformed
        this.dispose();
    }//GEN-LAST:event_jButton4ActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton3ActionPerformed
    {//GEN-HEADEREND:event_jButton3ActionPerformed
        String workingFolderPath;
        workingFolderPath = folderManager.FolderManager.checkAndCreateFolder(workingFolder);
        try
        {
            pdfManager.PdfManager.createPDF(workingFolderPath, customerPhone, orderNumber, documentPanel);
        }
        catch(BadElementException ex)
        {
            ExceptionManager.handleBadElementException(ex);
        }
        catch(DocumentException ex)
        {
            ExceptionManager.handleDocumentException(ex);
        }
        catch(FileNotFoundException ex)
        {
            ExceptionManager.handleFileNotFoundException(ex);
        }
        catch(MalformedURLException ex)
        {
            ExceptionManager.handleMalformedURLException(ex);
        }
        catch(IOException ex)
        {
            ExceptionManager.handleIOException(ex);
        }
        catch(Exception ex)
        {
            ExceptionManager.handleException(ex);
        }
    }//GEN-LAST:event_jButton3ActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel borderPanel;
    private javax.swing.JPanel documentPanel;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel66;
    private javax.swing.JLabel jLabel67;
    private javax.swing.JLabel jLabel68;
    private javax.swing.JLabel jLabel69;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel70;
    private javax.swing.JLabel jLabel71;
    private javax.swing.JLabel jLabel72;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JLabel lblCustomerAddress;
    private javax.swing.JLabel lblCustomerName;
    private javax.swing.JLabel lblCustomerPhone;
    private javax.swing.JLabel lblCustomerZip;
    private javax.swing.JLabel lblDate;
    private javax.swing.JLabel lblInvoiceNumber;
    private javax.swing.JLabel lblPaymentTerms1;
    private javax.swing.JLabel lblPaymentTerms2;
    private javax.swing.JLabel lblPaymentTerms3;
    private javax.swing.JLabel lblSalesTax;
    private javax.swing.JLabel lblSubtotal;
    private javax.swing.JLabel lblTotalSum;
    private javax.swing.JLabel lblVAT;
    private javax.swing.JPanel orderlinePanel;
    private javax.swing.JTextArea txtSubject;
    // End of variables declaration//GEN-END:variables
}